menu channel,status {
  Snitch
  .Snitch:/startsnitch $?="Number of Commands" $?="Interval" $active
  .-
  .$iif($group(#snitchauto) == off,Enable User Commands,Disable User Commands) {
    if ($group(#snitchauto) == off) {
      .enable #snitchauto
    }
    else {
      .disable #snitchauto
    }
  }
}
#snitchauto on
on *:TEXT:*:#:{
  if ($strip($1) == snitch && $strip($2) isnum && $strip($3) isnum && !$4-) {
    startsnitch $strip($2) $strip($3) $chan
  }
  if ($strip($1-) == snitch help) {
    .notice $nick type "snitch number of commands interval" - ie snitch 10 3
  }
  if ($strip($1-) == end snitch) {
    startsnitch end $chan
  }
}
#snithauto end
alias startsnitch {
  if ($1 != end) {
    if ($1 isnum && $2 isnum) {
      var %s = $1
      var %i = $2
      var %z = $2
      msg $3 6::appears::
      while (%s > 0) {
        .timer $+ $chan $+ -SB $+ %s 1 %i msg $3 6:: $+ $read(SnitchCommands.txt) $+ ::
        inc %i %z
        dec %s
      }
      .timerSBD- $+ $3 1 %i msg $3 6::disappears::
    }
    else {
      echo -a Enter in a number for the interval and number of commands.
    }
  }
  else {
    var %t = 1
    while ($timer(0) >= %t) {
      var %id = $addtok(%id,$timer(%t),32)
      inc %t
    }
    if ($wildtok(%id,SB*,1,32)) {
      var %nc = 1
      while (%nc <= $wildtok(%id,SBD-*,0,32)) {
        var %chan = $gettok($wildtok(%id,SBD-*,%nc,32),2,45)
        inc %nc
        if ($2 == $null) {
          msg %chan 6::disappears::
          .timer*-SB* off
          .timerSBD* off
        }
        elseif ($2 == %chan) {
          msg %chan 6::disappears::
          .timer $+ %chan $+ -SB* off
          .timerSBD- $+ %chan off
        }
      }
    }
  }
}